function on_friends_picker(friends) {
	html = new Array();
	friends.each(function(person) {
	  html.push('<option value="' + person.getId() + '">' + person.getDisplayName() + '</option>');
	});
	document.getElementById('ctrl_friends_picker').innerHTML = html.join(''); 
}

function on_upcoming_upcoming(friends) {
  return function(response) {
  	friendsMap = new Array();
  	friends.each(function(person) {
      friendsMap[person.getId()] = person.getDisplayName();
  	});
	  var contactLogs = gadgets.json.parse(response.data);    
    var html = new Array();
    for (var i = 0; i < contactLogs.length; i++) {
      html.push('<option value="' + contactLogs[i].key + '" >' +  friendsMap[contactLogs[i].friend_id] + ':' + contactLogs[i].log + '</option>');
    }
    document.getElementById('ctrl_upcoming_upcoming').innerHTML = html.join('');

    gadgets.window.adjustHeight();
  }
}
